home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright Cornell University 1986. All rights are reserved.
-
- nnr.c contains routines which display a "Network not responding"
- modeless dialog.
-
- */
-
- #include <em.h>
-
- #include <rcodes.h>
- #include <resdefs.h>
- #include <h19.h>
-
- #include <net.h>
-
- DialogPtr nnrdptr = NULL;
-
-
- #define PGSUCCESS TRUE
-
-
- /* put up a modeless dialog noting that the gateway or host is not
- responding
- */
-
- setnnr()
- {
- int itemtype;
- Handle itemh;
- Rect itembox;
- GrafPtr oport;
- extern int modaldialog;
-
- if (modaldialog)
- return(0);
-
- CouldDialog(NNRDLOG);
-
- if (IcEchoRequest(rnet->n_defgw, 0) != PGSUCCESS) {
- /* the gateway is presumably down */
- ParamText("\PGateway", "\P", "\P", "\P");
- }
- else {
- HLock(keydp->hhostname);
- ParamText("\Phost", *keydp->hhostname, "\P", "\P");
- HUnlock(keydp->hhostname);
- }
-
- if (!nnrup)
- /* because IcEchoRequest blocks, make sure the connection is still bad! */
- return(0);
-
- if (chkbackground())
- return(0);
-
- emwdeactivate();
- if ((nnrdptr = GetNewDialog(NNRDLOG,NULL,(WindowPtr) (-1))) == NULL)
- return (0);
-
- centerwind(nnrdptr);
-
- GetPort(&oport);
- SetPort(nnrdptr);
-
- SetCursor(&arrow);
- showcursor();
-
- DrawDialog(nnrdptr);
-
- SetPort(oport);
- return(0);
- }
-
-
- /* dispose of the network not responding alert */
-
- clearnnr()
- {
- if (nnrdptr == NULL)
- return;
- DisposDialog(nnrdptr);
- FreeDialog(NNRDLOG);
- nnrdptr = NULL;
- }
-
-
- nnrrefresh(thewind)
- WindowPtr thewind;
- {
- /*
- if (nnrdptr != NULL)
- if (thewind == nnrdptr)
- DrawDialog(nnrdptr);
- */
- }
-
-
- /* display the network not responding alert */
-
- shownnr()
- {
- if (nnrdptr != NULL) {
- ShowWindow(nnrdptr);
- BringToFront(nnrdptr);
- SetCursor(&arrow);
- showcursor();
- }
- }
-
-
- /* hide the network not responding alert */
-
- hidennr()
- {
- if (nnrdptr != NULL) {
- HideWindow(nnrdptr);
- SendBehind(nnrdptr);
- }
- }
-
-